﻿using System.Collections.Generic;
using PerceptiveMCAPI.Types;
//
namespace PerceptiveMCAPI
{
    internal static class listMergeVarAdd_Validator
    {
        // mergevar_option_field_type
        internal static Api_ValidatorMessage option_field_type_valid ( EnumValues.field_Type field_Type )
        {
            if ( field_Type == EnumValues.field_Type.NotSpecified )
            {
                return Validator.FormatMsg( EnumValues.MessageLevel.Error, "option.field_type",
                   "field_type was not specified and is required." );
            }
            return null;
        }
        // mergevar_option_choices
        internal static Api_ValidatorMessage option_choices_valid ( List<string> choices, EnumValues.field_Type field_type )
        {
            if ( choices.Count == 0
            && ( field_type == EnumValues.field_Type.radio || field_type == EnumValues.field_Type.dropdown ) )
            {
                return Validator.FormatMsg( EnumValues.MessageLevel.Error, "choices",
                 string.Format( "No choices have been defined for field type of {0}.", field_type.ToString() ) );
            }
            return null;
        }
    }
}
